<?php

namespace app\api\model;

use think\Model;

class Brandm extends Model
{
    //定义主键：id
    protected $pk = 'id';
    // 定义表名：tb_brand
    protected $table = 'tb_brand';

    public function categories() {
        return $this->belongsToMany('Cates', 'category_brand', 'category_id', 'brand_id')
            ->field('id, name');
    }
}
